package com.jwsoft.manager.core.gateway.controller;

import com.bifang.engine.assistant.core.domain.AppResponse;
import com.bifang.engine.protect.core.annotation.Idempotent;
import com.github.pagehelper.PageInfo;
import com.jwsoft.manager.common.vo.HouseholdConsistenct.HouseholdConsistenctQueryVO;
import com.jwsoft.manager.common.vo.HouseholdConsistenct.HouseholdConsistenctVO;
import com.jwsoft.manager.common.vo.eduHousehold.EduHouseholdVO;
import com.jwsoft.manager.core.integration.HouseholdConsistencyIntegration;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 房户一致管理
 *
 */
@RestController
@RequestMapping(value = "/doc/api")
@Tag(name = "HouseholdConsistency0001", description = "房户一致管理")
public class HouseholdConsistencyController {

    @Autowired
    public HouseholdConsistencyIntegration householdConsistencyIntegration;

    @Operation(summary = "房户一致管理查询",description = "房户一致管理查询")
    @PostMapping(value = "/householdConsistency0001", produces = "application/json;charset=UTF-8")
    public AppResponse<PageInfo<HouseholdConsistenctVO>> HouseholdConsistency(@RequestBody @Validated HouseholdConsistenctVO vo) {
        return AppResponse.successData(householdConsistencyIntegration.householdConsistency(vo));
    }
    @Operation(summary = "查询学生房产",description = "查询学生房产")
    @PostMapping(value = "/householdConsistency0002", produces = "application/json;charset=UTF-8")
    public AppResponse<List<HouseholdConsistenctVO>> queryHouse(@RequestBody @Validated HouseholdConsistenctVO vo) {
        return AppResponse.successData(householdConsistencyIntegration.queryHouse(vo));
    }
    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "更新预报名房产户籍是否一致信息",description = "更新预报名房产户籍是否一致信息")
    @PostMapping(value = "/householdConsistency0003", produces = "application/json;charset=UTF-8")
    public AppResponse update(@RequestBody @Validated HouseholdConsistenctVO vo) {
        householdConsistencyIntegration.update(vo);
        return AppResponse.success();
    }
    @Operation(summary = "查询学生户籍信息",description = "查询学生户籍信息")
    @PostMapping(value = "/householdConsistency0004", produces = "application/json;charset=UTF-8")
    public AppResponse<HouseholdConsistenctQueryVO> queryHousehold(@RequestBody @Validated HouseholdConsistenctQueryVO vo) {
        return AppResponse.successData(householdConsistencyIntegration.queryHousehold(vo));
    }
    @Operation(summary = "房户一致管理查询(管理员）",description = "房户一致管理查询(管理员）")
    @PostMapping(value = "/householdConsistency0005", produces = "application/json;charset=UTF-8")
    public AppResponse<PageInfo<HouseholdConsistenctVO>> householdConsistencyGly(@RequestBody @Validated HouseholdConsistenctVO vo) {
        return AppResponse.successData(householdConsistencyIntegration.householdConsistencyGly(vo));
    }
    @Operation(summary = "管理查询是否存在戶籍信息",description = "管理查询是否存在戶籍信息")
    @PostMapping(value = "/householdConsistency0006", produces = "application/json;charset=UTF-8")
    public AppResponse<EduHouseholdVO> getHousehold(@RequestBody @Validated EduHouseholdVO vo) {
        return AppResponse.successData(householdConsistencyIntegration.getHousehold(vo));
    }
}
